Developer Documentation

QuickTime 4 API Documentation

QuickTime Streaming

| Previous | Chapter Contents | Chapter Top | Next |

Set Up and Information Functions

Once your packetizer is initialized, it will receive several calls to set the information it needs prior to packetizing data, such as the media timescale. You may also be called with requests to return the settings you have been given. The main set up functions are listed below:

RTPMPSetTimeScale
RTPMPGetTimeScale
RTPMPSetPacketBuilder
RTPMPGetPacketBuilder
RTPMPSetMediaType
RTPMPGetMediaType
RTPMPSetMaxPacketSize
RTPMPGetMaxPacketSize
RTPMPSetMaxPacketDuration
RTPMPGetMaxPacketDuration


The Set functions listed above are used to set the time scale, packet builder (which receives your output), media type, maximum packet size, and maximum packet duration. These functions will be called before you are asked to begin packetizing data, and will not be called after you have begun packetizing data.

The Get functions listed above can be called at any time. When your packetizer is called with one of these Get functions, return the data that was passed to you in the corresponding Set function.

RTPMPSetTimeBase RTPMPGetTimeBase

The time base functions may be called for live transmission. The Set function sets the QuickTime time base that is in use. Your packetizer can query this time base to find out what time it is in the live stream. Your packetizer should not rely on receiving this call.

RTPMPHasCharacteristic may be called to determine whether your media packetizer has a particular characteristic, such as whether it supports a user settings dialog. Return qtsBadSelectorErr if your packetizer does not have the given characteristic.

ComponentResult RTPMPHasCharacteristic (
                     RTPMediaPacketizer rtpm,
                     OSType inSelector,
                     Boolean *outHasIt);


rtpm
The component instance of your media packetizer
inSelector
A selector for the characteristic. Defined selectors are:
kRTPMPNoSampleDataRequiredCharacteristic - if set, the media packetizer does not
require the actual sample data to perform packetization. The caller can pass in nil data pointers instead of pointers to the actual media data (see RTPMPSetSampleData ).
kRTPMPHasUserSettingsDialogCharacteristic - if set, the media packetizer supports the
calls RTPMPDoUserDialog , RTPMPGetSettingsIntoAtomContainerAtAtom, and RTPMPSetSettingsFromAtomContainerAtAtom.
kRTPMPPrefersReliableTransportCharacteristic - if set, the packetizer would prefer its
data to be sent reliably (such as Text or Music tracks, etc.)
kRTPMPRequiresOutOfBandDimensionsCharacteristic - if set, the original visual
dimensions of the media data cannot be determined simply by looking at the media packets, and must be transmitted via some other method.
outHasIt
Return a boolean which is true if your media packetizer has this characteristic, false otherwise.

If your packetizer supports a user dialog or additional settings, you may also receive dialog or settings calls as part of the set up process:

RTPMPDoUserDialog
RTPMPSetSettingsFromAtomContainerAtAtom
RTPMPGetSettingsIntoAtomContainerAtAtom
RTPMPGetSettingsAsText


The RTPMPDoUserDialog function will invoke your packetizer's modal dialog to obtain user settings.

The RTPMPGetSettingsIntoAtomContainerAtAtom function expects you to return those settings into an atom container at the specified offset.

The RTPMPSetSettingsFromAtomContainerAtAtom function is used to set the user settings programmatically, bypassing the user dialog.

The RTPMPGetSettingsAsText function expects you to return your user settings as text.

In addition to the set up calls listed above, you may receive RTPMPSetInfo function calls. These are used to send a variety of information to your packetizer, as indicated by the selector. If you don't support a given selector, return qtsBadSelectorErr .

RTPMPSetInfo selectors can be:

kQTSSourceTrackIDInfo ('otid'),/* UInt32* */
kQTSSourceLayerInfo ('olyr'),/* UInt16* */
kQTSSourceLanguageInfo ('olng'),/* UInt16* */
kQTSSourceTrackFlagsInfo ('otfl'),/* SInt32* */
kQTSSourceDimensionsInfo ('odim'),/* QTSDimensionParams* */
kQTSSourceVolumesInfo ('ovol'),/* QTSVolumesParams* */
kQTSSourceMatrixInfo ('omat'),/* MatrixRecord* */
kQTSSourceClipRectInfo ('oclp'),/* Rect* */
kQTSSourceGraphicsModeInfo ('ogrm'),/* QTSGraphicsModeParams* */
kQTSSourceScaleInfo ('oscl'),/* Point* */
kQTSSourceBoundingRectInfo ('orct'),/* Rect* */
kQTSSourceUserDataInfo ('oudt'),/* UserData */
kQTSSourceInputMapInfo ('oimp'),/* QTAtomContainer */


Your packetizer can be called with these selectors even if it indicated that it couldn't handle the given characteristic in its 'pcki' resource. In that case, return qtsBadSelectorErr .

Your packetizer may receive the related RTPMPGetInfo function at any time:

pascal ComponentResult RTPMPGetInfo(RTPMediaPacketizer rtpm,
                OSType inSelector, void *ioParams);


Your packetizer is expected to return the requested information in ioParams . The type of ioParams is dependent on inSelector . If you don't support the selector, return qtsBadSelectorErr . The selectors can be any of the selectors for RTPMPSetInfo or any of the additional selectors listed below:

/* info selectors - get only */
kRTPMPPayloadTypeInfo ('rtpp'),/* RTPMPPayloadTypeParams* */
kRTPMPRTPTimeScaleInfo ('rtpt'),/* TimeScale* */
kRTPMPRequiredSampleDescriptionInfo ('sdsc'), /* SampleDescriptionHandle* */
kRTPMPMinPayloadSize ('mins'),/* UInt32*, doesn't include rtp header; default 0 */
kRTPMPMinPacketDuration ('mind'), /* UInt3* in milliseconds; default is no min */
kRTPMPSuggestedRepeatPktCountInfo ('srpc'),/* UInt32* */
kRTPMPSuggestedRepeatPktSpacingInfo ('srps'), /* UInt32* in milliseconds */
kRTPMPMaxPartialSampleSizeInfo ('mpss'),/* UInt32* in bytes */
kRTPMPPreferredBufferDelayInfo ('prbd') /* UInt32* in milliseconds */


The kRTPMPPayloadTypeInfo selector requires you to fill out an RTPMPPayloadTypeParams structure.

/* flags for RTPMPPayloadTypeParams */
enum {
    kRTPMPPayloadTypeStaticFlag= 0x00000001,
    kRTPMPPayloadTypeDynamicFlag = 0x00000002
};

struct RTPMPPayloadTypeParams {
    UInt32  flags;
    UInt32  payloadNumber;
    short   nameLength;
/* in: size of payloadName buffer (counting null terminator)
/* -- this will be reset to needed length and paramErr returned if too small */
    char *                      payloadName;    /* caller must provide buffer */
};


typedef struct RTPMPPayloadTypeParams RTPMPPayloadTypeParams;

If you have a dynamic RTP payload type, you need to copy the payload type string to the buffer pointed to by payloadName (a null-terminated string). When RTPMPGetInfo is called, RTPMPPayloadTypeParams.nameLength will be the available size of the input buffer (specified by payloadName ). If this size is too small for the payload identifier, set nameLength to the size of the buffer you need (including the null terminator) and return paramErr . This will cause QuickTime to reallocate the buffer and call your packetizer again.

kRTPMPRTPTimeScaleInfo
return the RTP timescale used by this packetizer if the time scale must be a specific value; otherwise, return an error for this selector.
kRTPMPRequiredSampleDescriptionInfo return a handle to a sample description specifying that only
data with the given sample description is supported; if no such sample description exists, return an error for this selector.
kRTPMPMinPayloadSize
Return the minimum payload size, in bytes, of packets allowed by this packetizer (UInt32).
kRTPMPMinPacketDuration
Return the minimum packet duration allowed by this packetizer (UInt32, in milliseconds).
kRTPMPSuggestedRepeatPktCountInfo
Return the suggested number of repeat packets to send for this media (UInt32). This will typically be 0 for audio or video, nonzero for text or MIDI.
kRTPMPSuggestedRepeatedPktSpacingInfo
Return the suggested temporal distance between repeat packets (UInt32, in milliseconds).
kRTPMPMaxPartialSampleSizeInfo
Return the size of the largest partial sample your packetizer can accept (UInt 32 in bytes). If your packetizer returns true for HasCharacteristic ( kRTPMPPartialSamplesRequiredCharacteristic ), this call will be made to ask what the largest size (in bytes) is that the packetizer can handle receiving in a SetSampleData call.
Very few packetizers will need to set this -- it is intended only for media formats where a single media sample can be huge. MPEG is an example -- one media sample covers the entire span of the MPEG movie.
kRTPMPPreferredBufferDelayInfo
Return the preferred buffer delay for your packetizer (UInt32, in milliseconds). Most packetizers will not need to set this. This would only be set if the packet duration was sufficiently long that you needed a longer buffer delay to work.

© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |